package genetic.q4.v1;
import java.util.LinkedList;
import java.util.List;

import genetic.Genotype;
import genetic.q4.EternityPiece;

public class EternityGenotype implements Genotype{

	List<EternityPiece> rep;
	public EternityGenotype(List<EternityPiece> rep) {
		this.rep = rep;
	}

	@Override
	public int[] getIntString() {
		return null;
	}

	@Override
	public Genotype clone() {
		List<EternityPiece> newList = new LinkedList<EternityPiece>(rep);
		return new EternityGenotype(newList);
	}

	public double getSize() {
		return rep.size();
	}

	public EternityPiece getPiece(int i) {
		return rep.get(i);
	}

	public int indexOf(EternityPiece eternityPiece) {
		return rep.indexOf(eternityPiece);
	}
	
	@Override
	public String toString() {
		return getFitness() + " - " + rep.toString();
	}

	public double getFitness() {
		if (rep.size()<60) return rep.size();
		if (rep.get(0).getColor(EternityPiece.GRAY, 1, EternityPiece.GRAY, 3) == rep.get(59).getColor(EternityPiece.GRAY, 1)) return 61;
		return 60;
	}

}
